home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / lib / include / sun4.md / oldvarargs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-07-09  |  1.4 KB  |  47 lines

  1. /*
  2.  * varargs.h --
  3.  *
  4.  *    Macros for handling variable-length argument lists.
  5.  *
  6.  * Copyright 1988 Regents of the University of California
  7.  * Permission to use, copy, modify, and distribute this
  8.  * software and its documentation for any purpose and without
  9.  * fee is hereby granted, provided that the above copyright
  10.  * notice appear in all copies.  The University of California
  11.  * makes no representations about the suitability of this
  12.  * software for any purpose.  It is provided "as is" without
  13.  * express or implied warranty.
  14.  *
  15.  * $Header: /sprite/src/lib/include/sun4.md/RCS/varargs.h,v 1.2 89/02/24 22:01:03 mgbaker Exp Locker: rab $ SPRITE (Berkeley)
  16.  */
  17.  
  18. #ifndef _VARARGS
  19. #define _VARARGS
  20.  
  21. typedef struct {
  22.     char *vl_current;            /* Pointer to last arg returned from
  23.                      * list. */
  24.     char *vl_next;            /* Pointer to next arg to return. */
  25. } va_list;
  26.  
  27. /*
  28.  * An argument of list of __builtin_va_alist causes the sun4 compiler
  29.  * to store all the input registers, %i0 to %i5, in the stack frame
  30.  * so the var_arg() macro will be able to reference them in memory.
  31.  */
  32. #define va_alist __builtin_va_alist
  33.  
  34. #define va_dcl int __builtin_va_alist;
  35.  
  36. #define va_start(list) \
  37.     (list).vl_current = (list).vl_next = (char *) &__builtin_va_alist;
  38.  
  39. #define va_arg(list, type)            \
  40.     ((list).vl_current = (list).vl_next,    \
  41.     (list).vl_next += sizeof(type),        \
  42.      *((type *) (list).vl_current))
  43.  
  44. #define va_end(list)
  45.  
  46. #endif _VARARGS
  47.